import axios from '@/libs/api.request.js'

// 查询客户的地址列表
export const selectCustomerAddressList = data =>{
  return axios.request({
    method:"get",
    url:"/api/customer/info/selectCustomerAddressList",
  })
};

// 根据地址ID查询用户地址列表
export const selectCustomerAddressById = addressId =>{
  return axios.request({
    method:"get",
    url:"/api/customer/info/selectCustomerAddressById/"+addressId,
  })
};

// 新增地址信息
export const insertCustomerAddr = data =>{
  return axios.request({
    method:"post",
    url:"/api/customer/info/insertCustomerAddr",
    data:data,
  })
};

// 修改地址信息
export const updateCustomerAddr = data =>{
  return axios.request({
    method:"put",
    url:"/api/customer/info/updateCustomerAddr",
    data:data,
  })
};

// 切换默认地址信息
export const updateCustomerAddrDefault = addressId =>{
  return axios.request({
    method:"get",
    url:"/api/customer/info/updateCustomerAddrDefault/"+addressId,
  })
};

// 删除地址信息
export const deleteCustomerAddrById = addressId =>{
  return axios.request({
    method:"delete",
    url:"/api/customer/info/deleteCustomerAddrById/"+addressId,
  })
};


// TODO:这个接口是订单用的查询客户默认的地址信息
export const selectCustomerAddrByCustomerId = data =>{
  return axios.request({
    method:"get",
    url:"/api/customer/info/selectCustomerAddrByCustomerId",
  })
};

// TODO:这个接口是查询用户订单的可用优惠券
export const selectCustomerCouponList = supplierId =>{
  return axios.request({
    method:"get",
    url:"/api/customer/info/selectCustomerCouponList/"+supplierId,
  })
}

//TODO: 这个方法是我的页面查询可用优惠券用的
export const selectCustomerCoupon = data =>{
  return axios.request({
    method:"get",
    url:"/api/customer/info/selectCustomerCoupon",
  })
}

// TODO:领取店铺优惠券
export const installCustomerCode = data =>{
  return axios.request({
    method:"post",
    url:"/api/customer/info/installCustomerCode",
    data:data,
  })
}


// TODO:领取平台优惠券
export const addPlatformCouponCustomerCode = (data,supplierId) =>{
  return axios.request({
    method:"post",
    url:"/api/customer/info/addPlatformCouponCustomerCode",
    data:data,
  })
}

// 修改用户优惠券状态为使用过
export const updateCustomerCouponState = couponId =>{
  return axios.request({
    method:"get",
    url:"/api/customer/info/updateCustomerCouponState/"+couponId,
  })
}



